package com.cube.dp.cor.common;

import com.cube.dp.base.response.ApiResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author cube.li
 * @date 2021/12/23 14:24
 */
@RestControllerAdvice
@Slf4j
public class TransformExceptionHandler {

    @ExceptionHandler(TransformException.class)
    public ApiResult<Void> customExceptionHandler(TransformException ce) {
        log.error("短链转换异常,{}", ce.getMessage());
        return ApiResult.error(ce.getCode(), ce.getMessage());
    }
}
